// ...existing code...
#include <stdio.h>
#include <string.h>

int main()
{
    char a[100], b[100], c[100];
    if (!fgets(a, sizeof a, stdin)) return 0;
    if (!fgets(b, sizeof b, stdin)) return 0;
    if (!fgets(c, sizeof c, stdin)) return 0;

    /* 去掉换行符 */
    a[strcspn(a, "\n")] = '\0';
    b[strcspn(b, "\n")] = '\0';
    c[strcspn(c, "\n")] = '\0';

    /* 指针数组按字典序排序 */
    char *arr[3] = { a, b, c };
    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2 - i; ++j) {
            if (strcmp(arr[j], arr[j + 1]) > 0) {
                char *tmp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = tmp;
            }
        }
    }

    char min[100], mid[100], max[100];
    strcpy(min, arr[0]);
    strcpy(mid, arr[1]);
    strcpy(max, arr[2]);

    printf("min = %s\nmid = %s\nmax = %s\n", min, mid, max);
    return 0;
}
// ...existing code...